package webapps.demo1.server;

import server.HttpProtocolUtil;
import server.HttpServlet;
import server.Request;
import server.Response;

import java.io.IOException;

public class LagouServlet extends HttpServlet {

    public void doGet(Request request, Response response) {
//        try {
//            Thread.sleep(100000);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }

        String content ="<h1>LagouServlet get demo1 </h1>";
        try {
            response.outPut(HttpProtocolUtil.getHttpHeader200(content.getBytes().length) +content);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void doPost(Request request, Response response) {
        String content ="<h1>LagouServlet post </h1>";
        try {
            response.outPut(HttpProtocolUtil.getHttpHeader200(content.getBytes().length) +content);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void init() throws Exception {

    }

    public void destroy() throws Exception {

    }
}
